<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
    <meta name="format-detection" content="telphone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>忘记密码</title>
    <link href="__ROOT__/{$logo.ico}" rel="shortcut icon" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/forget.css">
    <!--//提高加载-->
    <script  type='text/javascript'>
        function $import(src){
            var scriptElem = document.createElement('script');
            scriptElem.setAttribute('src',src);
            scriptElem.setAttribute('type','text/javascript');
            document.getElementsByTagName('head')[0].appendChild(scriptElem);
        }
        // import with a random query parameter to avoid caching
        function $importNoCache(src){
            var ms = new Date().getTime().toString();
            var seed = "?" + ms;
            $import(src + seed);
        }
    </script>
    <style>
        .w22{width: 40%;padding: 5px 0px 5px 5px;height: 28px;line-height: 28px;border: 1px solid #cfcfcf;border-radius: 3px;background: #fdfdfd;}
        .code-tit{font-size:16px;color:#FFF;line-height: 30px;width:25%;margin-right:10px;text-align: center;}
        .code{width: 81px;font-size: 14px;color: #000;height: 40px;border-radius: 3px;cursor: pointer;margin-left:15px;padding:0px;}
    </style>
</head>

<body>
<div class="body">
    <img src="__PUBLIC__/home/Images/new-register.jpg">
</div>
<div class="logo"></div>
<div class="main">
    <div class="login">
        <h3><img src="__ROOT__/{$logo.logo}" alt="" style="width:350px;"></h3>
        <form action="__URL__/resetPwd" class="signform" method="post">
            <!--__ADMIN__/Index/login_date-->
            <div class="error-box"></div>
            <div class="login-group">
                <input type="text" class="login-input" placeholder="您的邮箱" title="输入邮箱" name="user_email" datatype="e" nullmsg="请输入邮箱！" errormsg="请输入正确的邮箱格式！" />
            </div>
            <div class="login-group">
                <label class="code-tit">邮箱验证码</label>
                <input type="text" class="w22"datatype="*" name="code" placeholder="请输入验证码" nullmsg="请输入验证码" errormsg="验证码格式有误" sucmsg=" "/>
                <input type="button" value="获取验证码" class="code"/>
            </div>
            <div class="login-group">
                <input type="password" class="login-input" placeholder="密码" name="password" maxlength="100" id="password" datatype="*6-16" nullmsg="请设置密码！" errormsg="密码范围在6~16位之间！" title="输入密码" />
            </div>
            <div class="login-group">
                <input type="password" class="login-input" placeholder="确认密码" name="repwd"  recheck="password" maxlength="100" id="repwd" datatype="*6-16" nullmsg="请设置密码！" errormsg="密码范围在6~16位之间！" title="输入密码" />
            </div>
            <div class="mt20 mb20">
                <button class="login-button" id="submit-btn">重置密码</button>
            </div>
            <div class="">
                <a href="<?=U('Index/loginView');?>" class="list-icon2">返回登录</a>
                <div class="clr"></div>
            </div>
        </form>
    </div>
</div>
<!--     <div class="footer mb20">
    金融集团 版权所有 蜀icp备2016022323号 copyright © 2005-2024 man sing financial All Rights Reserved.
</div> -->
<include file="Index/common_js"/>
<script>
    var index;
    $(function() {
        $(".signform").Validform({
            ajaxPost: true,
            btnSubmit:"#submit-btn",
            tiptype: function(msg, o, cssctl) {
                var objtip = $(".error-box");
                cssctl(objtip, o.type);
                objtip.text(msg);
            },beforeSubmit:function(curform){
                index = layer.load();
            },callback:function(data){
                layer.close(index);
                if(data.status==1){
                    layer.msg(data.msg,{icon: 1, time: 2000});
                    setTimeout(location.href="<?=U('Index/loginView');?>",2000);
                }else if(data.status==0){
                    layer.msg(data.msg,{icon: 2, time: 2000});
                }else{
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            }
        });
    });

    var flag=true;
    $('.code').click(function (){
        var email=$('input[name=user_email]').val();
        if(email.length<1){
            layer.msg('请填写邮箱地址',{icon: 2, time: 2000});return;
        }
        if(flag){
            index = layer.load();
            $.ajax({
                type:"POST",
                url:"__URL__/SendCode",//'__APP__/Admin/Index/login',//"{:U('Index/login')}",
                dataType:'json',
                data:{email:email},
                success:function(data){
                    //console.log(data);return;
                    //alert(JSON.stringify(data));return;
                    layer.close(index);
                    if(data.status ==1){
                        flag=false;
                        layer.msg(data.msg,{icon: 1, time: 2000});
                    }else{
                        layer.msg(data.msg,{icon: 2, time: 2000});
                    }
                },error:function(err){
                    console.log(err);
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            });
        }else{
            layer.msg('一分钟内不能重复发送',{icon: 2, time: 2000});
            setTimeout(function (){
                flag=true;
            },60000);
        }
    });
</script>
</body>
</html>
